<?php
	
	class xl_binh_luan_dia_diem extends database
	{
		/*khánh*/
		function tong_binh_luan($madiadiem){
			$this->setQuerry("select mabinhluan from binhluandiadiem where madiadiem=".$madiadiem."");
			$result = $this->loadAllRow();
			return count($result);
		}
		function dsBinhLuan($madiadiem){
			$this->setQuerry("select * from binhluandiadiem where madiadiem=".$madiadiem." order by mabinhluan desc limit 10");
			$result = $this->loadAllRow();
			return $result;
		}
		function dsBinhLuanViewMore($madiadiem,$last){
			$this->setQuerry("select * from binhluandiadiem where madiadiem=".$madiadiem." and mabinhluan < '$last' order by mabinhluan desc limit 10");
			$result = $this->loadAllRow();
			return $result;
		}
		/*end*/
		
		// tổng bình luận theo mã người dùng
		function tong_binh_luan_ca_nhan($manguoidung){
			$this->setQuerry("select * from binhluandiadiem where manguoidung=".$manguoidung."");
			$result = $this->loadAllRow();
			return count($result);
		}
		
		function danhSachBinhLuanDiaDiem()
		{
			$this->setQuerry('select * from binhluandiadiem');
			$result = $this->loadAllRow();
			return $result;
		}
		function themBinhLuanDiaDiem($madiadiem,$manguoidung,$noidung)
		{
			$this->setQuerry("insert into binhluandiadiem (MaDiaDiem,MaNguoiDung,NoiDung) values('$madiadiem','$manguoidung','$noidung')");
			$result=$this->querry();
			return $result;
		}
		function capNhatBinhLuanDiaDiem($mabinhluan,$madiadiem,$manguoidung,$noidung)
		{
			$this->setQuerry("update binhluandiadiem set MaDiaDiem=$madiadiem, MaNguoiDung=$manguoidung, NoiDung=$noidung where MaBinhLuan=$mabinhluan");
			$result=$this->querry();
			return $result;
		}
		function xoaBinhLuanDiaDiem($mabinhluan)
		{
			$this->setQuerry("delete from binhluandiadiem where MaBinhLuan=$mabinhluan");
			$result=$this->querry();
			return $result;
		}
	}
?>